package com.shop.mapper;

import com.shop.entity.Collection;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.shop.entity.MerchantMerchant;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * (Collection)表数据库访问层
 *
 * @author makejava
 * @since 2020-11-21 12:10:36
 */
@Mapper
public interface CollectionMapper extends BaseMapper<Collection> {
    @Select("select count(0) from collection where user_id=#{id}")
    int collectionCount(int userId);

    List<MerchantMerchant> getCollectionList(int userId);

    @Insert("insert into collection (user_id,merchant_id)values(#{userId},#{merchantId})")
    void addCollection(@Param("userId") Integer userId, @Param("merchantId") Integer merchantId);
}
